public class Test1 {
    public static void main(String[] args) throws InterruptedException {
        Object o1 = new Object() ;
        Thread t1 = new Thread(()->{
            System.out.println("t1 开始");
            synchronized(o1){
                try {
                    o1.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("t1 结束");
        });

        Thread t2 = new Thread(()->{
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
            }
            synchronized(o1){
               System.out.println("唤醒t1");
               o1.notify() ;
           }

        });
        t1.start();
        t2. start();



    }
}
